<%@ page language="java" contentType="text/html; charset=utf-8"
		 pageEncoding="utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<base href="<%=basePath%>">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title></title>
	<link href="../css/eys_stly.css" rel="stylesheet" type="text/css"/>
	<link href="../css/bootstrap.css" rel="stylesheet" type="text/css"/>
	<link href="../ss/css/bootstrap-table.css" rel="stylesheet" type="text/css"/>

</head>
<body>

<div class="index2">
	<h5>所在位置：<a>采购管理-采购进货统计表</a></h5>

	<form  id="search">
		<p class="p_line">

			<input type="text" name="name"   class="form-control" value="" placeholder="名称"/>
			<input type="date" name="purchaseId.beginCdate"   class="form-control" value="" placeholder="开始日期"/>
			<input type="date" name="purchaseId.endCDate"   class="form-control" value="" placeholder="结束日期"/>

			<a class=" button_style2" onclick="searchData(this)">查询</a>
			<a class=" button_style2" onclick="exportexcel()">导出</a>
		</p>
	</form>
	<p>
		<span class="alert"></span></p>

	<%-- <p>
         <button class="button_style2">批量导出</button>
     </p>--%>
	<p>

	<table   id="table" style="margin: 0 auto">
	</table>
	</p>

</div>

</div>
<script src="../js/jquery.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../ss/js/bootstrap-table.js"></script>
<script src="../ss/js/bootstrap-table-zh-CN.min.js"></script>
<script src="../ss/js/tableExport.min.js"></script>
<script type="text/javascript">
    var $alert = $('.alert').hide()
    var $table ;
    function exportexcel() {
        $('#table').tableExport({
            fileName:"采购进货统计表",
            type:'excel'
        });
    }
    $(function () {

        $table=$('#table').bootstrapTable({
            method: "post",
            striped: true,
            singleSelect: false,
            url: "../purchase_purchaseOrder/tjlistData",
            pagination: true, //分页
            pageSize: 10,
            pageNumber: 1,
            queryParamsType:'',
            queryParams: searchParam,
            sidePagination: "server",      //分页方式：client客户端分页，server服务端分页（*）
            search: false, //显示搜索框
            contentType: "application/x-www-form-urlencoded",

            columns: [
                {
                    title: "供应商名称",
                    field: 'companyname',
                    align: 'center',
                    valign: 'middle'
                },
                {
                    title: "商品编码",
                    field: 'code',
                    align: 'center',
                    valign: 'middle'
                },
                {
                    title: "商品名称",
                    field: 'name',
                    align: 'center',
                    valign: 'middle'
                },
                {
                    title: "数量",
                    field: 'amount',
                    align: 'center',
                    valign: 'middle'
                }

                ,
                {
                    title: "总价",
                    field: 'totalprice',
                    align: 'center',
                    valign: 'middle'
                }
            ]
        });



    })

    function searchParam(params) {
        var form = $("#search");
        var search = {};
        $.each(form.serializeArray(), function(i, field) {
            search[field.name] = field.value;
        });
        search.pageNo= params.pageSize;
        search.pageNum=params.pageNumber;
        return search;
    }
    function searchData(my){
        var form=$("#search");
        var search = {};
        $.each(form.serializeArray(), function(i, field) {
            search[field.name] = field.value;
        });
        var params = $("#table").bootstrapTable("getOptions");
        params.queryParams=function(params){

            search.pageNo= params.pageSize;
            search.pageNum=params.pageNumber;
            return search;
        };
        $("#table").bootstrapTable("refresh", params);

    }
    function showAlert(title, type) {
        $table.bootstrapTable('refresh')
        $alert.attr('class', 'alert alert-' + type || 'success')
            .html( title).show();
        setTimeout(function () {
            $alert.hide()
        }, 3000)
    }



</script>
</body>
</html>